//
//  ActivityCell.m
//  B段项目
//
//  Created by NeyMAr on 15/9/24.
//  Copyright (c) 2015年 昶博. All rights reserved.
//

#import "ActivityCell.h"
#import <UIImageView+WebCache.h>

@implementation ActivityCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
    
        self.imageView1 = [[UIImageView alloc] init];
        [self.contentView addSubview:self.imageView1];
        
        self.labelTitle = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelTitle];
        
        self.labelActivityTime = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelActivityTime];
        
        self.labelDate = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelDate];
        
        self.labelActivityPlace = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelActivityPlace];
        
        self.labelPlace = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelPlace];
        
        self.labelInterest = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelInterest];
        
        self.labelBorder = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelBorder];
    
    }
    
    return self;
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.imageView1.frame = CGRectMake(10 * w, 10 * h, 355 * w, 170 * h);
    
    self.labelTitle.frame = CGRectMake(10 * w, 190 * h, 355 * w, 50 * h);
    self.labelTitle.font = [UIFont boldSystemFontOfSize:17];
    self.labelTitle.numberOfLines = 0;
    
    self.labelActivityTime.frame = CGRectMake(10 * w, 240 * h, 120 * w, 30 * h);
    self.labelActivityTime.font = [UIFont systemFontOfSize:15];
    self.labelActivityTime.textColor = [UIColor darkGrayColor];
    
    self.labelDate.frame = CGRectMake(130 * w, 240 * h, 170 * w, 30 * h);
    self.labelDate.font = [UIFont systemFontOfSize:15];
    self.labelDate.textColor = [UIColor darkGrayColor];
    
    self.labelActivityPlace.frame = CGRectMake(10 * w, 270 * h, 90 * w, 30 * h);
    self.labelActivityPlace.font = [UIFont systemFontOfSize:15];
    self.labelActivityPlace.textColor = [UIColor darkGrayColor];
    
    self.labelPlace.frame = CGRectMake(100 * w, 270 * h, 240 * w, 30 * h);
    self.labelPlace.font = [UIFont systemFontOfSize:15];
    self.labelPlace.textColor = [UIColor darkGrayColor];
    self.labelPlace.numberOfLines = 0;
    
    self.labelInterest.frame = CGRectMake(140 * w, 330 * h, 200 * w, 30 * h);
    self.labelInterest.font = [UIFont systemFontOfSize:16];
    
    /* 横边框 */
    self.labelBorder.frame = CGRectMake(0, 320 * h, 375 * w, 1 * h);
    self.labelBorder.backgroundColor = [UIColor grayColor];
    self.labelBorder.alpha = 0.3;
}


- (void)setModel:(ActivityModel *)model
{
    NSString *strComment = [NSString string];
    strComment = model.eventInterest;
    _model = model;
    self.labelTitle.text = model.eventTitle;
    self.labelDate.text = model.eventEndTime;
    self.labelPlace.text = model.eventPlace;
    self.labelInterest.text = [NSString stringWithFormat:@"%@人感兴趣", strComment];
    self.labelActivityTime.text = @"活动截止时间:";
    self.labelActivityPlace.text = @"活动地点:";
    
    
    [self.imageView1 sd_setImageWithURL:[NSURL URLWithString:model.eventSmallImg] placeholderImage:[UIImage imageNamed:@"暂无图片.jpeg"]];
    
}










/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
